<div class="container">
  <h1>form_label()</h1>
  <p class="signature">function form_label(string $label_text, ?array $attributes = null): string</p>
  <h2>Description</h2>
  <div class="description">
    <p>Generates an HTML label element with optional attributes.</p>
  </div>
  <h2>Parameters</h2>
  <table>
    <thead>
      <tr>
        <th>Parameter</th>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>$label_text</td>
        <td>string</td>
        <td>The text or HTML to display inside the label element. This content is not escaped by default, so ensure proper sanitization if using user-generated content.</td>
      </tr>
      <tr>
        <td>$attributes</td>
        <td>array|null</td>
        <td>(optional) An associative array of HTML attributes for the label element. Default is null.</td>
      </tr>
    </tbody>
  </table>
  <h2>Return Value</h2>
  <table>
    <thead>
      <tr>
        <th>Type</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>string</td>
        <td>The generated HTML label element with any provided attributes.</td>
      </tr>
    </tbody>
  </table>
  <h2>Example #1</h2>
  <p>The code sample below demonstrates the basic usage of the <code>form_label</code> function with default parameters.</p>
  <pre>
$label_text = 'Username';
echo form_label($label_text);
// Output:
// &lt;label&gt;Username&lt;/label&gt;
  </pre>
  <h2>Example #2</h2>
  <p>The code sample below demonstrates a more complex usage of the <code>form_label</code> function with additional attributes.</p>
  <pre>
$label_text = 'Username';
$attributes = ['class' => 'form-label', 'for' => 'username'];
echo form_label($label_text, $attributes);
// Output:
// &lt;label class="form-label" for="username"&gt;Username&lt;/label&gt;
  </pre>
  <h2>Notes</h2>
  <ul>
    <li>The <code>$label_text</code> content is not escaped, allowing for more flexibility, such as including HTML. Be cautious when using user-generated content to avoid XSS vulnerabilities.</li>
    <li>The <code>$attributes</code> array allows for any valid HTML attributes to be added to the label element.</li>
  </ul>
</div>